# -*- coding: utf-8 -*-
"""
file:ch6_3三次函数的定积分-面积图
author: Fuwen
time: 2022/7/17 20:40
software:PyCharm
"""
import numpy as np
import matplotlib.pyplot as plt

# ∫(x**2)dx ,F(x) = 1/3 * x**3, x∈[1, 3] # 积分区间
# 被积函数f(x)的系数
a = 1

# 绘制定积分图形
x = np.linspace(0, 5, 1000)
y = a * x**2
plt.plot(x, y)
plt.fill_between(x, y1=y, y2=0, where=(x>=1)&(x<=3), facecolor='lightgreen')

plt.grid()
plt.show()